package cn.yllr.tomgxianghui.controller.admin;

import cn.yllr.tomgxianghui.domain.Order;
import cn.yllr.tomgxianghui.entity.Cart;
import cn.yllr.tomgxianghui.service.CartService;
import cn.yllr.tomgxianghui.service.OrderService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class Admin_CartController {
    @Resource
    OrderService orderService;

    //订单展示
    @RequestMapping("/toOrderLish")
    public String Order(Model model) {
        List<Order> orders = orderService.findorder();
        model.addAttribute("orders", orders);
        return "admin/indent";
    }

    //根据id删除订单
    @RequestMapping("/deleteOrder/{id}")
    public String deleteUser(@PathVariable("id") String id) {
        orderService.deleteOrders(id);
        return "redirect:/toOrderLish";
    }
}
